abstract class Animal {
    public abstract void eat();
}
interface Afraid {
    void escape();
    void makeSounds();
}
class Dog extends Animal implements Afraid {
    @Override
    public void eat() {
        System.out.println("狗吃骨头");
    }

    @Override
    public void escape() {
        System.out.println("狗害怕时逃跑");
    }

    @Override
    public void makeSounds() {
        System.out.println("狗汪汪叫");
    }
}
class Cat extends Animal implements Afraid {
    @Override
    public void eat() {
        System.out.println("猫吃鱼");
    }

    @Override
    public void escape() {
        System.out.println("猫害怕时逃跑");
    }

    @Override
    public void makeSounds() {
        System.out.println("猫喵喵叫");
    }
}
class Person {
    public void feed(Animal animal) {
        animal.eat();
    }

    public void catchAnimal(Afraid afraid) {
        afraid.escape();
        afraid.makeSounds();
    }
}
public class a {
    public static void main(String[] args) {
        // 父类引用子类实例
        Animal dog = new Dog();
        Animal cat = new Cat();

        Person person = new Person();

        // 调用方法
        person.feed(dog);
        person.feed(cat);

        person.catchAnimal((Afraid) dog);
        person.catchAnimal((Afraid) cat);
    }
}